package com.davidhigenbottam.HeatMap.data;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Logger;

import com.davidhigenbottam.HeatMap.shared.Query;
import com.google.appengine.api.rdbms.AppEngineDriver;

public class Data {
	protected static final Logger log = Logger
			.getLogger(Data.class.getName());
	
	Query query;
	
	public Data() {
		
	}
	public Data(Query q) {
		super();
		this.query= q;
	}

	public Connection getConnection() throws SQLException {
		
		long startTime = System.currentTimeMillis();
		System.out.println();
	
		Connection c = null;
	
		DriverManager.registerDriver(new AppEngineDriver());
	
		c = DriverManager
				.getConnection("jdbc:google:rdbms://studentheatmap-project-id:heatmap/heatmap");
		// studentheatmap-project-id:heatmap
		long endTime = System.currentTimeMillis();
		
		log.info("created connection That took " + (endTime - startTime) + " milliseconds");	
		return c;
	}

}